<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>版心居中</title>
    <style>
        div {
            width: 800px;
            height: 200px;
            background-color: #ff00d9;

            margin: 0 auto;
            text-align: center;
            line-height: 200px;
        }
    </style>
</head>
<body>
<div>我是一个div</div>
</body>
</html>